class PetDog {

    public String name;//名字
    public String color;//颜色

    public void setDog(String n,String c) {
        name = n;
        color = c;
    }

    // 狗的属性
    public void barks() {
        System.out.println(name + ": 旺旺旺~~~");
    }
    // 狗的行为
    public void wag() {
        System.out.println(name + ": 摇尾巴~~~");
    }
}

//1. 一般一个文件当中只定义一个类
//2. main方法所在的类一般要使用public修饰(注意：Eclipse默认会在public修饰的类中找main方法)
//3. public修饰的类必须要和文件名相同

public class Test1 {
    public static void main(String[] args) {

        PetDog dogh = new PetDog();
        dogh.name = "阿黄";
        dogh.color = "黄";
        dogh.barks();
        dogh.wag();

        PetDog dogs = new PetDog();
        dogs.setDog("赛虎","黑");
        dogs.barks();
        dogs.wag();
    }
}
